import Engine from '@/engine/Engine';
import HandlerManager from '@/handlers/HandlerManager';

class EditView {
  private _engine: Engine;
  private _handlerManager: HandlerManager;

  constructor(container: string | HTMLElement) {
    let dom;
    if (typeof container === 'string') {
      dom = document.querySelector<HTMLElement>(container);
    } else {
      dom = container;
    }
    if (!dom) {
      throw new Error('EditView: container is required');
    }
    this._engine = new Engine(dom);
    this._handlerManager = new HandlerManager(this);
  }

  render() {
    this._engine.render();
  }

  getContainer() {
    return this._engine.getContainer();
  }

  getEngine() {
    return this._engine;
  }
}

export default EditView;
